home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1993, 1994 Marc Parmet.
- * This file is part of the Macintosh port of GNU Emacs.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #include "stdio.h"
-
- main(int argc,char **argv)
- {
- char s[256];
- int i,err,failures,newproperty;
-
- if (argc < 2) {
- fprintf(stderr,"Usage: %s newvalue file1 [file2 ...]\n",argv[0]);
- return 1;
- }
-
- #ifdef chgrp_project
- strcpy(s,argv[1]);
- strcat(s," ");
- newproperty = *(long *)s;
- #else
- #ifdef chown_project
- strcpy(s,argv[1]);
- strcat(s," ");
- newproperty = *(long *)s;
- #else
- #ifdef chmod_project
- newproperty = 0;
- for (i = 0; i<strlen(argv[1]); ++i)
- newproperty = 8*newproperty + (argv[1][i] - '0');
- #else
- #error
- #endif
- #endif
- #endif
-
- failures = 0;
- for (i = 2; i<argc; ++i) {
- #ifdef chgrp_project
- err = chgrp(argv[i],newproperty);
- #else
- #ifdef chown_project
- err = chown(argv[i],newproperty);
- #else
- #ifdef chmod_project
- err = chmod(argv[i],newproperty);
- #else
- #error
- #endif
- #endif
- #endif
-
- if (err < 0) {
- fprintf(stderr,"%s: Can't modify %s\n",argv[0],argv[i]);
- failures = 1;
- }
- }
-
- return failures;
- }
-